

#include "Poller.hpp"
#include "EventLoop.hpp"

namespace tulun
{
    void EventLoop::loop()
    {
        looping_ = true;
        quit_ = false;
        while (!quit_)
        {
            activeChannels_.clear();
            pollRetunrTime_ = poller_->poll(kPollTimeMs, &activeChannels_);
            eventHandling_ = true;
            for (auto it : activeChannels_)
            {
                it->handleEvent(&pollRetunrTime_);
            }
            eventHandling_ = false;
            doPendingFunctors();
        }
    }
} // namespace tulun
